<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>箭头函数</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            margin: 200px auto;
            text-align: center;
            line-height: 200px;
            font-size: 20px;
            border: 1px solid black;
            margin-bottom: 50px;
        }
        span{
            font-size: 50px;
            margin-left: 740px;
        }
    </style>
</head>
<body>
    <div id="box">开始</div>
    <span id="number">0</span>
    <script>
        var box=document.getElementById('box');
        var number=document.getElementById('number');
      
        var gu={
     
            rui:function(){
                var x=0;
                box.onclick=()=>{
                    setInterval(()=>{
                       x++
                        number.innerHTML=x;
                    },1000);
                }
            }
        }
        gu.rui();
    </script>
</body>
</html>